package adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by lenovo on 2016/6/23.
 * Viewpager适配器
 */
public class MyFragmentpagerAdapter extends FragmentPagerAdapter{
    List<Fragment> list1;//fragment
    List<String> list;//标题
    public MyFragmentpagerAdapter(FragmentManager fm, List<String> list, List<Fragment> list1) {
        super(fm);
        this.list1=list1;
        this.list=list;
    }

    @Override
    public Fragment getItem(int position) {
        return list1.get(position);
    }

    @Override
    public int getCount() {
        return list1.size();
    }
     //最上面字体显示
    @Override
    public CharSequence getPageTitle(int position) {
        return null==list?"":list.get(position);
    }
}
